Skip to content

fix(publisher): omit repository when URL cannot be detected#1149

Merged
rdimitrov merged 1 commit intomodelcontextprotocol:mainfrom
JosephDoUrden:fix/empty-repository-uri
Apr 15, 2026
Merged

fix(publisher): omit repository when URL cannot be detected#1149
rdimitrov merged 1 commit intomodelcontextprotocol:mainfrom
JosephDoUrden:fix/empty-repository-uri

Conversation

@JosephDoUrden
Copy link
Copy Markdown
Contributor

Summary

When detectRepoURL() cannot determine the repository (no git remote, no package.json repository field), return an empty string instead of a placeholder URL (https://github.com/YOUR_USERNAME/YOUR_REPO). This causes createServerJSON() to omit the repository field entirely, preventing schema validation failures on publish.

Fixes #613

Problem

mcp-publisher init generated a repository object with a placeholder URL that fails the uri format validation on publish. 88 published servers in the official registry had this issue.

Change

  • cmd/publisher/commands/init.go: detectRepoURL() returns "" instead of placeholder when no repo is found
  • The existing guard in createServerJSON() (if repoURL != "" && repoSource != "") already handles this correctly — it omits the repository when URL is empty

Test plan

  • go build ./cmd/publisher/... compiles
  • go test ./cmd/publisher/commands/... passes
  • Manual: mcp-publisher init in a directory without git remote or package.json repo — verify no repository field in generated server.json
  • Manual: mcp-publisher init in a git repo — verify repository is populated correctly

AI Disclosure

AI assistance (Claude) was used for issue research. The implementation was written and reviewed by the author.

Return an empty string from detectRepoURL() when no repository can be
determined, instead of a placeholder URL. This causes createServerJSON()
to omit the repository field entirely, avoiding schema validation
failures from empty or placeholder URI values on publish.

Fixes modelcontextprotocol#613
Copy link
Copy Markdown
Member

@rdimitrov rdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, @JosephDoUrden! 🙌 🚀

@rdimitrov rdimitrov merged commit 8df5a77 into modelcontextprotocol:main Apr 15, 2026
3 checks passed
@JosephDoUrden JosephDoUrden deleted the fix/empty-repository-uri branch April 15, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty registry uri fails schema (caused by mcp-publisher)

2 participants